# -*- coding:utf-8 -*-
import requests
import bs4

URL ='http://www.yhdm.io/'

UAHEAD = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36'}

UAHEAD['referer'] = URL
ENCODING = 'gb2312'
ENCODING = 'utf-8'
def gettitles(url):
    res = requests.get(url, headers=UAHEAD)
    res.encoding = ENCODING
    
    soup = bs4.BeautifulSoup(res.text,'html5lib')
    for li in soup.find_all("div", class_="menu")[0].find_all("li"):
        li.

gettitles(URL)